package test;
// 银行账户类
public class BankAccount {
    private double balance;

    public BankAccount(double initialBalance) {
        this.balance = initialBalance;
    }

    public void withdraw(double amount) throws Abnormal.InsufficientBalanceException {
        if (amount > balance) {
            throw new Abnormal.InsufficientBalanceException("余额不足，无法取款");
        }
        balance -= amount;
    }

    public double getBalance() {
        return balance;
    }
}
